﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Sbook.Data;
using System.Data.SqlClient;
using System.Data;

namespace Sbook.Business
{
    public class DeliveryService : SqlDataProvider
    {
        private static DeliveryController db = new DeliveryController();

        #region[Delivery_GetByAll]
        public static List<Data.DeliveryInfo> Delivery_GetByAll()
        {
            return db.Delivery_GetByAll();
        }
        #endregion

        #region[Delivery_GetByTop]
        public static List<Data.DeliveryInfo> Delivery_GetByTop(string top, string where, string order)
        {
            return db.Delivery_GetByTop(top, where, order);
        }
        #endregion

        #region[Delivery_DeleteById]
        public static bool Delivery_DeleteById(string Id)
        {
            return db.Delivery_DeleteById(Id);
        }
        #endregion


        #region[Delivery_GetCountByWhere]
        public static int Delivery_GetCountByWhere(string where)
        {
            return db.Delivey_GetCountByWhere(where);
        }
        #endregion


        #region[Delivery_GetByWherePaging]
        public static List<Data.DeliveryInfo> Delivery_GetByWherePaging(string currentPage, string pageSize, string where)
        {
            return db.Delivery_GetByWherePaging(currentPage, pageSize, where);
        }
        #endregion

        #region[Delivery_Insert]
        public static int Delivery_Insert(Data.DeliveryInfo obj)
        {
            return db.Delivery_Insert(obj);
        }
        #endregion
        #region[Delivery_Update]
        public static bool Delivery_Update(Data.DeliveryInfo obj)
        {
            return db.Delivery_Update(obj);
        }
        #endregion
        #region[Delivery_UpdateById]
        public static bool Delivery_UpdateById(string set, string Id)
        {
            using (SqlCommand cmd = new SqlCommand("sp_Delivery_UpdateById", GetConnection()))
            {
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@set", set);
                cmd.Parameters.AddWithValue("@Id", Id);
                cmd.ExecuteNonQuery();
            }
            return true;
        }
        #endregion
    }
}